//
//  SocketManager.h
//  Proto
//
//  Created by kingly on 15/11/23.
//  Copyright © 2015年 Will. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "DataPacket.h"
#import "TakePacket.h"

@class DataPacket;
@protocol SocketManagerDelegate;
@interface SocketManager : NSObject 

+(SocketManager*)getInstance;

/**
 *  发送数据
 *
 *  @param prot 协议信息
 *  @param data 封装的数据
 */
- (void) sendContent:(DataPacket*)dataPacket;

/**
 * 创建 socket连接
 */
- (void)connectToUrl:(NSURL *)url;

/**
 * SocketManager 的协议成员
 */
@property (nonatomic,weak) id <SocketManagerDelegate>myDelegate;

@end


/**
 * SocketManager 的协议
 */
@protocol SocketManagerDelegate <NSObject>
@optional

/**
 *  socket 读取数据
 */
-(void) socketDidReadData:(NSData *)data;

/**
 * socket 连接失败或有误
 */
-(void) socketDidDisconnectWithError:(NSError *)error;

@end
